// logs.js
const util = require('../../utils/util.js')

Page({
  data: {
    logs: [],
    scanLogs: []
  },
  onLoad() {
    const bootLogs = (wx.getStorageSync('logs') || []).map(log => ({
      date: util.formatTime(new Date(log)),
      timeStamp: log
    }))
    const scanLogs = (wx.getStorageSync('scanLogs') || []).map(item => ({
      date: util.formatTime(new Date(item.ts)),
      value: item.value,
      type: item.type,
      charLen: item.charLen
    }))
    this.setData({ logs: bootLogs, scanLogs })
  }
})
